package com.wfx.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.wfx.entity.WxbGoodsCopy;
import com.wfx.entity.WxbOrder;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author zhu
 * @since 2021-01-23
 */
public interface WxbOrderMapper extends BaseMapper<WxbOrder> {
    @Select("SELECT date_format( order_time,'%Y-%m-%d')as dat,count(1) as cunt FROM wxb_order GROUP BY date_format( order_time,'%Y-%m-%d')")
    public List<Map>  statOrdercuntPerDay();


    @Select("select date_format(order_time,'%Y-%m') as dat,count(1) as cunt from wxb_order group by date_format( order_time,'%Y-%m')")
    public List<Map> statOderCuntPerMoth();


    @Select("SELECT date_format( wd.order_time,'%Y-%m-%d') as dat, SUM(wi.sku_price) as cunt FROM wxb_order   wd\n" +
            "LEFT JOIN wxb_order_items wi ON wd.order_id = wi.order_id WHERE wd.state=2\n" +
            "GROUP BY date_format( wd.order_time,'%Y-%m-%d') ")
    public List<Map> statOderCuntPerMoney();


    IPage<WxbOrder> findOrder(IPage iPage, WxbOrder wxbOrder);




}
